package com.koron.css2.clientCenter.impl;

import com.koron.css2.ServerInterface;
import com.koron.css2.clientCenter.bean.ChangeUserImportBean;
import com.koron.css2.clientCenter.mapper.ChangeUserImportMapper;
import com.koron.css2.serviceManage.bean.RequestBean;
import com.koron.css2.serviceManage.bean.UserInfoBean;
import com.koron.css2.serviceManage.utils.JsonUtils;
import com.koron.util.Constant;
import org.koron.ebs.mybatis.SessionFactory;
import org.swan.bean.MessageBean;

public class ChangeUserImportDel implements ServerInterface {

	@Override
	public MessageBean<?> exec(SessionFactory factory, UserInfoBean userInfo, RequestBean req) {
		// TODO Auto-generated method stub
		try {
			ChangeUserImportBean bean = JsonUtils.objectToPojo(req.getData(), ChangeUserImportBean.class);
			ChangeUserImportMapper cmapper = factory.getMapper(ChangeUserImportMapper.class);
			cmapper.delete(bean.getId());
			cmapper.deleteDetail(bean.getId());
			return MessageBean.create(Constant.MESSAGE_INT_SUCCESS, "删除成功", null);
		} catch (Exception e) {
			logger.error("批量变更列表查询失败" + e.getMessage(), e);
			return MessageBean.create(Constant.MESSAGE_INT_FAIL, "查询失败", null);
		}
	}

}
